package com.growthsee.rider.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.growthsee.rider.domain.Common;
import com.growthsee.rider.mapper.CommonMapper;
import com.growthsee.rider.service.CommonService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Objects;

@Service
@AllArgsConstructor
public class CommonServiceImpl extends ServiceImpl<CommonMapper, Common> implements CommonService {


    @Override
    public String getKeyByParam(String param) {
        Common common = baseMapper.selectOne(Wrappers.<Common>lambdaQuery().eq(Common::getConfigKey,param));
        if(Objects.isNull(common))return null;
        return common.getConfigValue();
    }
}
